<? if(!defined('BASEPATH')) exit('No direct script access allowed');

/** 
 * Encryption :: two-way encryption class using RIJNDAEL 256 AES standard 
 *
 * @uses MCRYPT_RIJNDAEL_256 
 */ 
class Encryption
{

	private $key = 'gap!Hah77Hows';
	private $iv_size;
	private $iv; 

    /** 
     * constructor 
     * @return void 
     */ 
    function __construct()
	{ 
        $this->iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); 
        $this->iv = mcrypt_create_iv($this->iv_size, MCRYPT_RAND); 
    } 

	public function encrypt($string)
	{ 
        $string=trim($string); 
        return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->key, $string, MCRYPT_MODE_ECB, $this->iv)); 
    } 

	public function decrypt($string)
	{ 
        return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256,$this->key,base64_decode($string),MCRYPT_MODE_ECB,$this->iv)); 
    } 
}

/* End of file encryption.php */
